<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加管理</title>
<style>
.txt20 {
	font-size: 20px;
}

.td {
	font-size: 18px;
	height: 50px;
	text-align: right;
}

.input {
	width: 200px;
	height: 25px;
}

.star {
	font-size: 12px;
	color: red;
}
</style>
</head>
<body>
	<div class="txt20">当前位置-->添加管理</div>
	<div>
		<%
			if (request.getAttribute("adduserinfo") != null) {
				out.print(request.getAttribute("adduserinfo"));
			}
		%>
		<form action="doadduser.jsp" method="post">
			<table width="95%" cellspacing="1" cellpadding="0" align="center"
				style="background-color: azure">
				<tr>
					<td colspan="2" height="30px"></td>
				</tr>
				<tr>
					<td class="td">用户名：</td>
					<td><input type="text" name="username" class="input"
						value="<%request.setCharacterEncoding("UTF-8");
			HashMap<String, String> formlist = new HashMap<String, String>();
			if (request.getAttribute("form") != null) {
				formlist = (HashMap<String, String>) request.getAttribute("form");
			}
			if (formlist.get("username") != null) {
				out.print(formlist.get("username"));
			}%>">
						<%
							ArrayList<Integer> errlist = new ArrayList<Integer>();
							if (request.getAttribute("info") != null) {
								errlist = (ArrayList<Integer>) request.getAttribute("info");
							}
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 1) {
									out.println("<span class=\"star\">*请输入用户名。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">密&nbsp;码：</td>
					<td><input type="password" name="userpass" class="input">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 2) {
									out.print("<span class=\"star\">*请输入密码。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">确认密码：</td>
					<td><input type="password" name="comuserpass" class="input">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 3) {
									out.println("<span class=\"star\">*请输入确认密码。</span>");
									break;
								} else if (errlist.get(i) == 4) {
									out.println("<span class=\"star\">*请输入密码与确认密码不一致。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">姓名：</td>
					<td><input type="text" name="name" class="input"
						value="<%if (formlist.get("name") != null) {
				out.print(formlist.get("name"));
			}%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 5) {
									out.println("<span class=\"star\">*请输入姓名。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">用户类别：</td>
					<td><input type="text" name="type" class="input" value="一般管理员"
						readonly="readonly"></td>
				</tr>
				<tr>
					<td class="td">电话：</td>
					<td><input type="text" name="usertel" class="input"
						value="<%if (formlist.get("usertel") != null) {
				out.print(formlist.get("usertel"));
			}%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 6) {
									out.println("<span class=\"star\">*请输入电话。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td></td>
					<td height="50px"><input type="image" src="../img/sub1.png"
						name="submit" style="width: 120px; height: 30px;"></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>